package com.hushow.demo.process;

import com.alibaba.fastjson.JSONObject;
import lombok.extern.slf4j.Slf4j;
import org.springframework.batch.core.configuration.annotation.StepScope;
import org.springframework.batch.item.*;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
@StepScope
@Slf4j
public class MyItemWriter implements ItemWriter {

    @Value("#{jobParameters[taskId]}")
    private String taskId;

    @Override
    public void write(List items) throws Exception {
        log.info("item:{}", JSONObject.toJSONString(items));
    }
}
